<?php


namespace app\erp\controller;


use app\erp\model\PikuanLogdb;

class Pikuanlog extends Base
{
    protected $cols = array(
        array(
            'field' => 'id',
            'width' => 40,
            'title' => 'ID',
            'type' => 'checkbox',
        ),

        array(
            'field' => 'return_code',
            'width' => 160,
            'title' => '回款单号'
        ),
        array(
            'field' => 'log_txt',
            'width' => 200,
            'title' => '描述'
        ),
        array(
            'field' => 'param',
            'width' => 400,
            'title' => '请求参数'
        ),
        array(
            'field' => 'result',
            'width' => 160,
            'title' => '返回结果'
        ),
        array(
            'field' => 'log_date',
            'width' => 160,
            'title' => '操作日期'
        ),
        array(
            'field' => 'username',
            'width' => 160,
            'title' => '操作人'
        ),

    );

    public $post = array();

    public function _initialize()
    {
        parent::_initialize();
        $request = request();
        $param = $request->param();
        $this->post = $param;
    }

    public function index()
    {
        $this->assign('cols', json_encode($this->cols));
        return $this->fetch();
    }

    public function ajaxList()
    {
        $pikuanxinxiDb = new PikuanLogdb();
        $pikuanxinxiDb->param = $this->post;
        $get_list = $pikuanxinxiDb
            ->order('id desc')
            ->paginate($this->post['limit']);
        $this->layuiReturn($get_list->items(), $get_list->total());
    }
}